package com.itheima.arraysDemo;

import java.util.Arrays;
import java.util.Comparator;

public class ArraysDemo1 {
    public static void main(String[] args) {
        Integer[] arr = {1,2,3,4,5,6,7,8,9};

        Arrays.sort(arr, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                // o1 - o2 升序
                // o2 - o1 降序
                return o2 - o1;
            }
        });

        System.out.println(Arrays.toString(arr));
    }
}
